package com.itheima.service.impl;

import com.itheima.dao.UserDao;
import com.itheima.model.User;
import com.itheima.service.UserService;

import java.util.List;
import java.util.Map;
import java.util.Properties;

/**
 * @author wuli
 * @create 2021-11-05 7:50
 */
public class UserServiceImpl implements UserService {

    private String username;
    private Integer age;
    private List<String> strList;
    private Map<String, User> userMap;
    private Properties properties;

    private UserDao userDao;

    public UserServiceImpl() {
    }

    public UserServiceImpl(String username, Integer age, List<String> strList, Map<String, User> userMap, Properties properties) {
        this.username = username;
        this.age = age;
        this.strList = strList;
        this.userMap = userMap;
        this.properties = properties;
    }

    public UserServiceImpl(UserDao userDao) {
        this.userDao = userDao;
    }

    /**
     * set注入
     *
     * @param userDao
     */
    /*public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }*/
    public void save() {
        userDao.save();
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public void setStrList(List<String> strList) {
        this.strList = strList;
    }

    public void setUserMap(Map<String, User> userMap) {
        this.userMap = userMap;
    }

    public void setProperties(Properties properties) {
        this.properties = properties;
    }

    @Override
    public String toString() {
        return "UserServiceImpl{" +
                "username='" + username + '\'' +
                ", age=" + age +
                ", strList=" + strList +
                ", userMap=" + userMap +
                ", properties=" + properties +
                '}';
    }
}
